package string.related;

public class UrlGetHost {

	public static void main(String[] args) {
		String http = "http://www.sina.com/api/index/latest_news?SessionId";
		String https = "https://192.168.6.226:9999/api/index/latest_news?SessionId";
		urlGetHost(http, 7);
		urlGetHost(https, 8);
	}

	private static void urlGetHost(String url, int ssl) {
		int start = ssl, end = 0;
		url = url.substring(start);
		end = url.indexOf('/');
		url = url.substring(0, end);
		System.out.println("host =  " + url);
		System.out.println("host =  " + url.indexOf("sina"));
		
		
	}

}
